package control;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JComboBox;

import utils.DataWriter;
import utils.IDataWriter;

import model.Catalogo;

public class FilterListener implements ActionListener {

	private Catalogo catalogo;
	private JComboBox<String> filter;
	private JButton button = new JButton();

	public FilterListener(Catalogo catalogo, JComboBox<String> filter) {
		this.catalogo = catalogo;
		this.filter = filter;
		this.button = button;

	}

	@Override
	public void actionPerformed(ActionEvent e) {

		Object src = e.getSource();
		if (src.getClass().equals(button.getClass())) {
			System.out.println(catalogo.genText());
		}
		catalogo.setFilter(filter.getSelectedItem().toString());
		//System.out.println(filter.getSelectedItem().toString());
		
		
	//	event.setFilter(filter.getSelectedItem().toString());

	}

}
